<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no">
    <script src="vue.min.js"></script>
    <script src="https://cdn.bootcss.com/vue-router/3.1.2/vue-router.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .headerbox{
             width: 100%;
             height: 20vh;
             background: red;
             text-align: center;
             line-height: 20vh;
         }
        .leftbox{
            flex: 2.5;
            height: 80vh;
            background: blue;
            text-align: center;
            line-height: 80vh;
        }
        .mainbox{
            flex: 7.5;
            height: 80vh;
            background: yellow;
            text-align: center;
            line-height: 80vh;
        }

        .v-enter, .v-leave-to {
            opacity: 0;
            transform: translateY(20px);
        }

        .v-enter-active, .v-leave-active {
            transition: all 0.5s ease;
        }

    </style>
</head>
<body>

<div id="app">
    <router-view></router-view>
    <div style="display: flex;">
        <router-view name="left"></router-view>
        <router-view name="main"></router-view>
    </div>

    <!--<router-link to="/login/11" tag="span">登录</router-link>-->
    <!--<router-link to="/zhuce" tag="span">注册</router-link>-->


    <!--<transition mode="out-in">-->
    <!--<router-view></router-view>-->
    <!--</transition>-->

</div>


<script>

    //组件模板对象
    var header = {
        template: '<div class="headerbox"><h3>我是头部组件</h3></div>',
    };
    var leftbox = {
        template: '<div class="leftbox"><h3>我是左边栏组件</h3></div>',
    };
    var mainbox = {
        template: '<div class="mainbox"><h3>我是主体栏组件</h3></div>',
    };

    var routerObj = new VueRouter({
        routes: [//路由匹配规则
            // {path: '/', redirect: '/login'},//强制重新定向（默认向你展示的那一页）
            {
                path: '/', components: {
                    'default':header,
                    'left':leftbox,
                    'main':mainbox,
                }
            },

        ]
    });


    let app = new Vue({
        el: '#app',
        data() {
            return {
                message: '我爱你 Vue!'
            }
        },
        methods: {},
        router: routerObj
    })
</script>
</body>
</html>